//
// See the file COPYING for redistribution information.
//

#ifndef __NAIPAX_INTERNAL_FNV_HPP__
#define __NAIPAX_INTERNAL_FNV_HPP__

#include <stdint.h>

namespace Naipax {
    namespace Internal {
        static const uint32_t FNV_128_DIGEST_SIZE = 16;
        
        /** This class implements the 128-bit FNV-1a algorithm. This
         * class also assumes uint64_t is defined.
         *
         * @see http://isthe.com/chongo/tech/comp/fnv/
         */
        class Fnv {
        public:
            /** Compute FNV-128 hash, and save result in a
             * 16-byte-long buffer.
             *
             * @param pData
             * @param DataLen
             * @param pDigest Caller must make sure pDigest points to
             *                a buffer with enough space.
             * @exception Error::INVALID_ARGUMENT if pData or pDigest
             *            is NULL.
             */
            static void Hash128(const char *pData, uint32_t DataLen,
                                void *pDigest);
        };
    };
};

#endif // __NAIPAX_INTERNAL_FNV_HPP__
